<ul class="nav pills">
    <? $menus = include_once RESOURCE_PATH . 'menu.php';?>
    <? 
        $url=$_SERVER["REQUEST_URI"];
        $str='<li><a href="/">首 页</a></li>';
        if($url=="/"):
            $str=' <li class="active"><a href="/">首 页</a></li>';
        endif;
        echo $str;
        if ($menus) :
        $id=1;
        foreach ($menus as $menu) : 
            if ($menu['submenus']) : 
                foreach ($menu["submenus"] as $submenu) :              
                    $menuactive[$id][]=$submenu["url"];   
                endforeach;       
            endif;
               $id++;
        endforeach;
        $id=1;
        foreach ($menus as $menu) :
            $active="";
            if (isset($menuactive[$id])) :
                if(in_array($url, $menuactive[$id])):
                   $active=" active"; 
                endif;
            endif;
            $id++;
    ?>
    <li class="dropdown<? echo $active;?>">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#menu1"><?=$menu['title']?><b class="caret"></b></a>
        <ul class="dropdown-menu">
            <?if ($menu['submenus']) : ?>
                <? foreach ($menu['submenus'] as $submenu) : ?>
            <li><a href="<?=$submenu['url']?>"><?=$submenu['title']?></a></li>
                <? endforeach; ?>
            <? endif; ?>
        </ul>
    </li>
    <? endforeach; ?>
    <? endif; ?>
 </ul>
<script>
$(".dropdown-toggle").mouseover(function(){
                  $(this).trigger("click");
              });
</script>